﻿@model  TMT_CMS.BL.Model.User.UserRoleViewModel
<!-- Box -->
<script type="text/javascript">
    $(document).ready(function () {
        $('#btnSubmitGroup').click(function () {
            $('#AddRoleForm').submit();
        });
        $('#resetForm').click(function () {
            $('#userName').val('');
        });
    });
</script>
@using (Html.BeginForm("UserRoleUpdate", "User", FormMethod.Post, new { ID = "AddRoleForm" }))
{ @Html.ValidationSummary(true)
    <div class="box">
        <!-- Box Head -->
        <div class="box-head">
            <h2>
                用户组信息更新</h2>
        </div>
        <!-- End Box Head -->
        <!-- Form -->
        <div class="table">
            <table class="tableForForm">
                <tr>
                    <td align="right">
                        用户组名：
                    </td>
                    <td>
                        @Html.HiddenFor(model=>model.ID)
                        @Html.TextBoxFor(model => model.RoleName, new { @class = "field size3", ID = "userName" })
                        @Html.ValidationMessageFor(model => model.RoleName)
                    </td>
                    <td align="right">
                        <a href="javascript:void()" class="cancel-button" id="resetForm"><span>清空</span></a>
                        <a href="javascript:void()" class="submit-button" id="btnSubmitGroup" style="margin-left: 10px;">
                            <span>保存</span></a>
                    </td>
                </tr>
            </table>
        </div>
    </div>
    <!-- End Box -->
    <!-- Box -->
    <div class="box">
        <!-- Box Head -->
        <div class="box-head">
            <h2>
                权限一览</h2>
        </div>
        <!-- End Box Head -->
        <!-- Table -->
        <div class="table">
            <table width="100%" border="0" cellspacing="0" cellpadding="0">
                <tr>
                    <th width="13">
                        <input type="checkbox" class="checkbox" onclick="CheckAll(this,'PermissionIDs')" />
                    </th>
                    <th>
                        权限名称
                    </th>
                </tr>
                @foreach (PermissionEx permission in Model.Permissions)
                {
                    <tr>
                        <td>
                            @if(permission.IsChecked)
                            {
                                <input type="checkbox" class="checkbox" name="PermissionIDs" value=" @permission.ID" checked="checked"/>
                            }
                            else
                            {
                                <input type="checkbox" class="checkbox" name="PermissionIDs" value=" @permission.ID"/>
                            }
                            
                            @*        @Html.CheckBoxFor(t=>permission.IsChecked,new { ID = "userName", @value = @permission.ID})
                            @Html.CheckBox("PermissionIDs", permission.IsChecked, new { ID = "userName", @value = @permission.ID })
                            @Html.ValidationMessageFor(m=>m.Permissions,"请选择")*@
                        </td>
                        <td>
                            <h3>
                                <a href="#">@permission.Name</a>
                            </h3>
                        </td>
                    </tr>
                }
            </table>
            <!-- Pagging -->
            <div class="pagging">
            </div>
            <!-- End Pagging -->
        </div>
        <!-- Table -->
    </div>
}
@section SideBar{
    <div class="box">
        <!-- Box Head -->
        <div class="box-head">
            <h2>
                用户权限管理</h2>
        </div>
        <!-- End Box Head-->
        <div class="box-content">
            <a href="@Url.Action("UserRoleList", "User")" class="add-button"><span>用户组管理</span></a>
            <div class="cl">
                &nbsp;</div>
        </div>
    </div>
}
